# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-zstd
_extname=zstd
pkgver=0.11.0
pkgrel=0
pkgdesc="PHP 8.1 Zstandard extension - PECL"
url="https://pecl.php.net/package/zstd"
arch="all !armhf" # tests fails on armhf builders
license="MIT"
depends="php81-common"
makedepends="php81-dev php81-pecl-apcu zstd-dev"
checkdepends="php81-openssl"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize81
	./configure --prefix=/usr --with-php-config=php-config81 --with-libzstd
	make
}

check() {
	local _modules=/usr/lib/php81/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/apcu.so \
		-d extension=$_modules/openssl.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php81/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
faf1ea07a7b9c4f8a4ee732b7f17fc104670ebc6a2babe83d297dc59b945f843f671ad03e668290a282485e746bd9b9381daec38c0e5e5749ca93cba5eb594ae  php-pecl-zstd-0.11.0.tgz
"
